﻿<ad:DockableContent x:Class="tiDE.Panels.StartPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
             mc:Ignorable="d" Title="Start Page"
             d:DesignHeight="600" d:DesignWidth="600">
    <ad:DockableContent.Background>
        <SolidColorBrush>
            <SolidColorBrush.Color>
                <Color A="255"  R="209" G="236" B="255"></Color>
            </SolidColorBrush.Color>
        </SolidColorBrush>
    </ad:DockableContent.Background>
    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="/Images/start-background.jpg" Stretch="UniformToFill" AlignmentX="Right" AlignmentY="Bottom"></ImageBrush>
        </Grid.Background>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>

        <Image Source="/Images/startPageLogo.png"></Image>

        <StackPanel x:Name="PageControlsPanel" Grid.Row="1" Cursor="Hand" Margin="20 25 0 0">
            <Border x:Name="NewProjectButton" MouseLeftButtonDown="NewProjectButton_MouseLeftButtonDown" HorizontalAlignment="Stretch" Margin="0 0 0 10" CornerRadius="8"
                    BorderBrush="Transparent" BorderThickness="1" MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
                <Grid Margin="10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Image Width="48" Height="48" Source="/Images/Icons/Icons.48x48.NewProject.png"></Image>
                    <TextBlock Grid.Column="1" FontSize="24" VerticalAlignment="Center">New Project...</TextBlock>
                </Grid>
            </Border>
            <Border x:Name="OpenProjectButton" MouseLeftButtonDown="OpenProjectButton_MouseLeftButtonDown" HorizontalAlignment="Stretch" Margin="0 0 0 10" CornerRadius="8" BorderBrush="Transparent" BorderThickness="1"
                    MouseEnter="Border_MouseEnter" MouseLeave="Border_MouseLeave">
                <Grid Margin="10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Image Width="48" Height="48" Source="/Images/Icons/Icons.48x48.OpenProject.png"></Image>
                    <TextBlock Grid.Column="1" FontSize="24" VerticalAlignment="Center">Open Project...</TextBlock>
                </Grid>
            </Border>
        </StackPanel>

        <Grid Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <TextBlock FontSize="24">Recent Projects</TextBlock>
            <TextBlock FontSize="18" Grid.Row="1" Margin="15 0 0 0">No recent projects</TextBlock>
        </Grid>

        <Grid Grid.Row="1" Grid.RowSpan="2" Grid.Column="1" Margin="20 0 0 0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>

            <StackPanel>
                <TextBlock FontSize="24">Latest News</TextBlock>
                <TextBlock>You can enable or disable different RSS feeds in the settings.</TextBlock>
                <TextBlock FontSize="18" x:Name="NewsFeedLoadingText">Loading...</TextBlock>
                <StackPanel x:Name="ErrorLoadingFeedsPanel" Visibility="Collapsed" Orientation="Horizontal">
                    <Image Source="/Images/Icons/Icons.24x24.Error.png" Margin="0 0 10 0"></Image>
                    <TextBlock FontSize="18" VerticalAlignment="Center">Error loading feeds.</TextBlock>
                </StackPanel>
            </StackPanel>
            <ListBox x:Name="NewsFeedListBox" Grid.Row="1" Background="Transparent" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="NewsFeedListBox_SelectionChanged">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Height="100" BorderThickness="1" BorderBrush="Transparent" Cursor="Hand" MouseEnter="Border_MouseEnter" Background="Transparent"
                                MouseLeave="Border_MouseLeave" Padding="10" CornerRadius="8" Margin="5" MouseLeftButtonDown="Border_MouseLeftButtonDown_1">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"></RowDefinition>
                                    <RowDefinition Height="*"></RowDefinition>
                                </Grid.RowDefinitions>
                                <TextBlock Text="{Binding FeedTitle}"></TextBlock>
                                <Grid Grid.Row="1">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                                        <ColumnDefinition Width="*"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"></RowDefinition>
                                        <RowDefinition Height="*"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <Image Source="{Binding ImageSource}" Stretch="None" Height="80" Grid.RowSpan="2" Margin="0 0 5 0"></Image>
                                    <TextBlock FontSize="18" Text="{Binding ItemTitle}" Grid.Column="1"></TextBlock>
                                    <TextBlock Grid.Column="1" Grid.Row="1" TextTrimming="WordEllipsis" TextWrapping="Wrap" Text="{Binding ItemSnippet}"></TextBlock>
                                </Grid>
                            </Grid>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
</ad:DockableContent>
